﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.ServiceModel;
using Model;

namespace PositionServer.Service
{
    [ServiceContract]
    public interface IPositionService
    {
        /// <summary>
        /// return 1 means succeed 87
        /// </summary>
        /// <returns></returns> 
        [OperationContract]
        int TestWCF();



        [OperationContract]
        List<PassengerInfo> GetNearbyPassengerByCarType(
            double longitude, double latitude, double distance,
            int usertype, string carType);

        [OperationContract]
        List<PassengerInfo> GetAllPassengerByCarType(int usertype, string carType);

        [OperationContract]
        int SetPassengerToCar(string carPhoneNum,
                              byte carType, string psgPhoneNum);

        [OperationContract]
        int SetPassengerPresetValue(string psgPhoneNum, object presetValue);
 
        /// <summary>
        /// 设置目的地Id
        /// </summary>
        /// <param name="type">类型 0为车辆设置目的地  1-为乘客设置</param>
        /// <param name="phoneNumber"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        [OperationContract]
        int SetDestinationId(int type, string phoneNumber, int id);

        [OperationContract]
        DestinationInfo AddDestinationByClient(DestinationInfo model);

        [OperationContract]
        void DeleteDestinationById(int id);

        [OperationContract]
        void ClearDestinationByClient();

        [OperationContract]
        List<DestinationInfo> GetNearbyDestinationInfo(
            double longitude, double latitude, double distance, string type);

        [OperationContract]
        List<DestinationInfo> GetAllDestinationInfo();

        [OperationContract]
        void DeletePassengerByClient(string phoneNumber);

        [OperationContract]
        void ClearCarPassengerByClient(string carPhone, string psgPhone);

        /// <summary>
        /// return nearby TaxiInfo 
        /// </summary>
        /// <param name="longitude"></param>
        /// <param name="latitude"></param>
        /// <param name="distance"> kilometer</param>
        /// <param name="type">0---Taxi,1---PhoneUser</param>
        /// <returns></returns>
        [OperationContract]
        List<Model.TaxiInfo> GetNearbyGps(double longitude, double latitude, double distance, int type);

        [OperationContract]
        List<Model.TaxiInfo> GetNearbyGpsByCompany(double longitude, double latitude, double distance, int type,
                                             string company);
        /// <summary>
        /// Verify client platform user name and password 
        /// </summary>
        /// <param name="userName"></param>
        /// <param name="password"></param>
        /// <returns>true/false</returns>
        [OperationContract]
        bool CheckUser(string userName, string password);

        [OperationContract]
        bool ChangePassWordByUserName(string userName, string newPwd);

        [OperationContract]
        List<string> GetCompanyList();

        /// <summary>
        /// Get All Taxi Infomation
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        List<Model.TaxiInfo> GetAllTaxiInfos();

        [OperationContract]
        List<Model.TaxiInfo> GetAllTaxiInfosByCompany(string company);

        /// <summary>
        /// Add Taxi info into Database(TaxiNo,TaxiType,Remark )
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        bool TaxiInfoAdd(Model.TaxiInfo model);

        [OperationContract]
        Model.TaxiInfo TaxiGetModel(int id);

        /// <summary>
        /// Update Taxi from Database(TaxiNo,TaxiType,Remark )by id
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        bool TaxiInfoUpdate(Model.TaxiInfo model);

        /// <summary>
        /// Delete Taxi from Database by id
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        bool TaxiInfoDelete(int id);

        /// <summary>
        /// Delete Taxi from Database by idlist-- like  1,2,3
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        bool TaxiInfoDeleteList(string idlist);

        /// <summary>
        /// Get Taxis from Database if strWhere="" getallTaxiInfo
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataSet TaxiInfoGetList(string strWhere);

        /// <summary>
        /// Get Taxis from Database where parameter like @parameterVaule
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        DataSet TaxiInfoGetListWithPar(string parameter, string parameterVaule);

        /// <summary>
        /// check taxiNo if exist in database
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        bool TaxiInfoisExist(string taxiNo);



        [OperationContract]
        Model.DriverInfo DriverGetModel(int id);

        [OperationContract]
        bool DriverAdd(Model.DriverInfo driverInfo);

        [OperationContract]
        bool DriverUpdate(Model.DriverInfo model);

        [OperationContract]
        bool DriverDelete(int id);

        [OperationContract]
        bool DriverExistphone(string driverPhoneNum);

        [OperationContract]
        bool DriverDeleteList(string idlist);

        [OperationContract]
        DataSet DriverGetList(string strWhere);

        [OperationContract]
        DataSet DriverGetListWithPar(string parameter, string parameterVaule);


        [OperationContract]
        bool DriverExist(string wrokId);



        [OperationContract]
        bool UserAdd(Model.UserInfo model);

        [OperationContract]
        bool UserUpdate(Model.UserInfo model);

        [OperationContract]
        bool UserDelete(int id);

        [OperationContract]
        bool UserDeleteList(string idlist);

        [OperationContract]
        DataSet UserGetList(string strWhere);

        [OperationContract]
        bool UserExist(string userName);



        [OperationContract]
        bool RoleAdd(Model.RoleInfo model);

        [OperationContract]
        bool RoleUpdate(int id, string name, string permission, string remark);

        [OperationContract]
        string[] GetRoleInfoByUserName(string username);

        [OperationContract]
        bool RoleDelete(int id);

        [OperationContract]
        bool RoleDeleteList(string idlist);

        [OperationContract]
        DataSet RoleGetList(string strWhere);

        [OperationContract]
        bool RoleExist(string roleName);



        [OperationContract]
        bool ComplaintAdd(Model.ComplaintInfo model);

        [OperationContract]
        bool ComplaintUpdate(Model.ComplaintInfo model);

        [OperationContract]
        bool ComplaintDelete(int id);

        [OperationContract]
        bool ComplaintDeleteList(string idlist);

        [OperationContract]
        DataSet ComplaintGetList(string strWhere);

        [OperationContract]
        DataSet ComplaintGetListOfPassenger(string strWhere);

        [OperationContract]
        DataSet TradeGetList(string strWhere);

        [OperationContract]
        DataSet TradeGetReport(string strWhere);

        [OperationContract]
        bool TaxiAdAdd(Model.TaxiAdInfo model);

        [OperationContract]
        bool TaxiAdUpdate(Model.TaxiAdInfo model);

        [OperationContract]
        bool TaxiAdDelete(int id);

        [OperationContract]
        bool TaxiAdDeletebyTaxiIdAdId(int taxiId, int adid);

        [OperationContract]
        bool TaxiAdDeleteList(string idlist);

        [OperationContract]
        DataSet TaxiAdGetList(string strWhere);

        [OperationContract]
        bool TaxiAdExist(int taxiId, int adId);


        [OperationContract]
        DataSet TaxiGpsHistoryGetList(string driverPhoneNumber, DateTime startTime, DateTime endTime);

        [OperationContract]
        DataSet TaxiGpsHistoryGetListWhere(string strWhere);


        [OperationContract]
        int TaxiGpsHistoryGetRecordCount(string strWhere);

        [OperationContract]
        DataSet GetTaxiOnlineCountReport(string strWhere);

        [OperationContract]
        DataSet TaxiGpsHistoryGetStatisticsList(string strWhere);

        /// <summary>
        /// 得到指定的出租车空载率、载客率，指定按小时、天、月、年统计
        /// </summary>
        /// <param name="intObject">出租车对象类型：1为单辆，2为一分组，3为全部</param>
        /// <param name="strValue">对象值</param>
        /// <param name="dateType">统计时间类型：1为小时，2为天，3为月，4为年</param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        [OperationContract]
        DataSet TaxiGpsHistoryGetStatisResult(int intObject, string strValue,
           int  dateType, string strWhere);

        /// <summary>
        /// ArrayList al=new ArrayList {phoneNo, receDateTime, content};
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        ArrayList ReadSms();

        /// <summary>
        /// 
        /// </summary>
        /// <param name="phone"> Less 31,like 18602789588</param>
        /// <param name="content">Less 255</param>
        /// <returns></returns>
        [OperationContract]
        int SendSms(string phone, string content);

        /// <summary>
        /// SMS ID
        /// </summary>
        /// <param name="id">SMS ID</param>
        /// <returns></returns>
        [OperationContract]
        bool SmsQuery(int id);

        [OperationContract]
        bool TaxiGroupExist(string taxiGroup);

        [OperationContract]
        bool TaxiGroupAdd(Model.TaxiGroupInfo model);

        [OperationContract]
        bool TaxiGroupUpdate(Model.TaxiGroupInfo model);

        [OperationContract]
        bool TaxiGroupDelete(int id);

        [OperationContract]
        DataSet TaxiGroupGetList(string strWhere);



        [OperationContract]
        bool TaxiAreaExit(int taxiid);

        [OperationContract]
        bool TaxiAreaAdd(Model.TaxiAreaInfo model);

        [OperationContract]
        bool TaxiAreaUpdate(Model.TaxiAreaInfo model);

        [OperationContract]
        bool TaxiAreaDelete(int taxiid);

        [OperationContract]
        DataSet TaxiAreaGetList(string strWhere);

        [OperationContract]
        bool GmapoverlayAdd(Model.GmapoverlayInfo model);

        [OperationContract]
        bool GmapoverlayUpdate(Model.GmapoverlayInfo model);

        [OperationContract]
        bool GmapoverlayDelete(int id);

        [OperationContract]
        Model.GmapoverlayInfo GmapoverlayGetModel(int id);

        [OperationContract]
        DataSet GmapoverlayGetList(string strWhere);

        [OperationContract]
        DataSet GmapoverlayGetListByParameter(string parameter, string parameterVaule);

        [OperationContract]
        int GmapoverlayGetRecordCount(string strWhere);

        [OperationContract]
        DataSet PhoneUserGetReportByRecommender(int[] rangeValue, string strWhere);

        [OperationContract]
        DataSet PhoneUserGetList(string strWhere);

        /// <summary>
        /// 按规定的时间分段统计登录人次
        /// </summary>
        /// <param name="dateType">时间划分类型：1按小时，2按天，3按月</param>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        [OperationContract]
        DataSet PhoneUserGetReportByTime(int dateType, string strWhere);

        /// <summary>
        /// 按用户登录次数分段统计
        /// </summary>
        /// <param name="rangeValue">分段值数组</param>
        /// <param name="strWhere">其他条件</param>
        /// <returns></returns>
        [OperationContract]
        DataSet PhoneGetReportByLoginCount(int[] rangeValue, string strWhere);


        /// <summary>
        /// 按用户交易次数统计
        /// </summary>
        /// <param name="rangeValue">分段数组</param>
        /// <param name="strWhere">其他条件，如指定交易时间段 time 范围</param>
        /// <returns></returns>
        [OperationContract]
        DataSet PhoneUserGetReportByTradeTimes(int[] rangeValue, string strWhere);

        /// <summary>
        /// 得到手机用户总数
        /// </summary>
        /// <param name="parameter">条件查询 列名</param>
        /// <param name="parameterValue">值 （模糊查询）</param>
        /// <returns></returns>
        [OperationContract]
        int PhoneUserGetCount(string parameter, string parameterValue);

        /// <summary>
        /// 得到指定分页的用户列表
        /// </summary>
        /// <param name="page">分页页码 从1开始</param>
        /// <param name="pagesize">每页数据条数</param>
        /// <param name="parameter">条件查询 列名</param>
        /// <param name="parameterValue"> 查询的值（模糊查询）</param>
        /// <returns></returns>
        [OperationContract]
        DataSet PhoneUserGetListByPage(int page, int pagesize, string parameter, string parameterValue);

        /// <summary>
        /// 得到指定日期的拨出电话次数统计列表
        /// </summary>
        /// <param name="strWhere">日期范围 calltime</param>
        /// <returns></returns>
        [OperationContract]
        DataSet CallRecordsGetReportByDay(string strWhere);

        [OperationContract]
        bool CallRecordsAdd(Model.CallRecordsInfo callRecordsInfo);

        [OperationContract]
        DataSet CallRecordsGetList(string strWhere);

        /// <summary>
        /// 返回指定条件内的数据条数
        /// </summary>
        /// <param name="strWhere">查询条件 如：calltime between xx and xx</param>
        /// <returns></returns>
        [OperationContract]
        int CallRecordsGetCount(string strWhere);

        /// <summary>
        /// 返回指定分页数据
        /// </summary>
        /// <param name="page">页码</param>
        /// <param name="pagesize">每页数目</param>
        /// <param name="strWhere">其他条件</param>
        /// <returns></returns>
        [OperationContract]
        DataSet CallRecordsGetListByPage(int page, int pagesize, string strWhere);

        /// <summary>
        /// 返回指定分页的报警数据
        /// </summary>
        /// <param name="page"></param>
        /// <param name="pagesize"></param>
        /// <param name="strWhere">datetime,Warmingstate,PhoneNumber</param>
        /// <returns></returns>
        [OperationContract]
        DataSet TaxiWarmingGetListByPage(int page, int pagesize, string strWhere);

        /// <summary>
        /// 获取满足指定条件的记录总数
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        [OperationContract]
        int TaxiWarmingGetRecordCount(string strWhere);

        /// <summary>
        /// Add Trade successful  Info
        /// </summary>
        /// <param name="tradeInfo"></param>
        [OperationContract]
        void AddTradeInfo(Model.TradeInfo tradeInfo);

        /// <summary>
        /// 获取客户端最新版本号
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        string GetClientVersion();


        /// <summary>
        /// 查询指定服务器名称是否已存在
        /// </summary>
        /// <param name="servername">服务器名称</param>
        /// <returns></returns>
        [OperationContract]
        bool ServerConfigExists(string servername);
       
        [OperationContract]
        bool ServerConfigAdd(Model.ServerConfigInfo model);
 
        [OperationContract]
        bool ServerConfigUpdate(Model.ServerConfigInfo model);
 
        [OperationContract]
        bool ServerConfigDelete(int id);
 
        [OperationContract]
        Model.ServerConfigInfo ServerConfigGetModelById(int id);
 
        [OperationContract]
        Model.ServerConfigInfo ServerConfigGetModelByName(string servername);

        [OperationContract]
        Model.ServerConfigInfo GetServerConfigByTaxiId(int id);

        [OperationContract]
        bool UpdateServerIdByTaxiId(int taxiId, int serverId);

        /// <summary>
        /// 获取服务器配置列表
        /// </summary>
        /// <param name="strWhere"></param>
        /// <returns></returns>
        [OperationContract]
        DataSet ServerConfigGetList(string strWhere);


        [OperationContract]
        List<string> GetBlackListOfPasseager();

         
        [OperationContract]
        bool AdMachineExists(string number);

        [OperationContract]
        bool AdMachineAdd(Model.ADMachineInfo model);

        [OperationContract]
        bool AdMachineUpdate(Model.ADMachineInfo model);

        [OperationContract]
        bool AdMachineDelete(string number);

        [OperationContract]
        bool AdMachineDeleteList(string idlist);

        [OperationContract]
        Model.ADMachineInfo AdMachineGetModel(int id);

        [OperationContract]
        DataSet AdMachineGetList(string strWhere);

        [OperationContract]
        int AdMachineUpdateUrlInList(string adUrl, string stationlist);

        [OperationContract]
        DataSet PrivateCarGetListByPage(int page, int pagesize, string parameter, string parameterValue);

        [OperationContract]
        int PrivateCarGetCount(string parameter, string parameterValue);

        [OperationContract]
        bool PrivateCarDeleteById(int id);

        [OperationContract]
        DataSet TaxiOnlineTimeGetList(string date1, string date2, string parameter, string parameterVaule);

        [OperationContract]
        DataSet TaxiOnlineTimeGetListWhere(string date1, string date2, string strWhere);


        [OperationContract]
        DataSet TaxiRouteGetListByPhoneNumberAndTime(string phoneNumber, string startTime, string endTime);

        [OperationContract]
        DataSet TaxiRouteGetStatisticsByPara(string phoneNumber, string startTime, string endTime);

        [OperationContract]
        DataSet TaxiRouteGetStatisReportResult(
        int intObject, string strValue, int dateType, string startTime, string endTime);


        [OperationContract]
        bool TaxiNoPsgConfigExists(string phoneNumber);

        [OperationContract]
        bool TaxiNoPsgConfigAdd(Model.TaxiNoPsgDistanceConfig model);

        [OperationContract]
        bool TaxiNoPsgConfigUpdate(Model.TaxiNoPsgDistanceConfig model);

        [OperationContract]
        bool TaxiNoPsgConfigDelete(int id);

        [OperationContract]
        DataSet TaxiNoPsgConfigGetList(string strWhere);

        [OperationContract]
        Model.TaxiNoPsgDistanceConfig TaxiNoPsgConfigGetModel(string phoneNumber);


        [OperationContract]
        bool CompanyExists(string companyName);

        [OperationContract]
        bool CompanyAdd(Model.CompanyInfo model);

        [OperationContract]
        bool CompanyUpdate(Model.CompanyInfo model);

        [OperationContract]
        bool CompanyDelete(int id);

        [OperationContract]
        Model.CompanyInfo CompanyGetModel(int id);

        [OperationContract]
        DataSet CompanyGetList(string strWhere);

        [OperationContract]
        Model.UserInfo CheckUserWithReturn(string userName, string password);

         
        [OperationContract]
        string GetUserAreaByPhoneNumber(string phonenumber);

        [OperationContract]
        DataSet PrivateGetPhoneNumberList(string strWhere);



        #region  RentCar
        [OperationContract]
        bool RentCarPhoneNumberExists(string phoneNumber);

        [OperationContract]
        bool RentCarAdd(Model.RentCarInfo model);

        [OperationContract]
        bool RentCarUpdate(Model.RentCarInfo model);

        [OperationContract]
        bool RentCarDelete(int id);

        [OperationContract]
        Model.RentCarInfo RentCarGetModel(int id);

        [OperationContract]
        DataSet RentCarGetList(string strWhere);

        #endregion

        #region CityOfRentCar

        [OperationContract]
        bool CityOfRentCarExists(string cityName);

        [OperationContract]
        bool CityOfRentCarAdd(Model.CityOfRentCarInfo model);

        [OperationContract]
        bool CityOfRentCarUpdate(Model.CityOfRentCarInfo model);

        [OperationContract]
        bool CityOfRentCarDelete(int id);

        [OperationContract]
        Model.CityOfRentCarInfo CityOfRentCarGetModel(int id);

        [OperationContract]
        DataSet CityOfRentCarGetList(string strWhere);

        #endregion


        #region SpecialCar

        [OperationContract]
        bool SpecialCarPhoneNumberExists(string phoneNumber);

        [OperationContract]
        bool SpecialCarAdd(Model.SpecialCarInfo model);

        [OperationContract]
        bool SpecialCarUpdate(Model.SpecialCarInfo model);

        [OperationContract]
        bool SpecialCarDelete(int id);

        [OperationContract]
        Model.SpecialCarInfo SpecialCarGetModel(int id);

        [OperationContract]
        DataSet SpecialCarGetList(string strWhere);

        #endregion


        #region TAXICDMA

        [OperationContract]
        bool CdmaTaxiExistsDeviceNumber(string deviceNumber);

        [OperationContract]
        bool CdmaTaxiAdd(Model.TaxiCdmaInfo model);

        [OperationContract]
        bool CdmaTaxiUpdate(Model.TaxiCdmaInfo model);

        [OperationContract]
        bool CdmaTaxiDelete(int id);

        [OperationContract]
        bool CdmaTaxiDeleteList(string idlist);

        [OperationContract]
        Model.TaxiCdmaInfo CdmaTaxiGetModelById(int id);

        [OperationContract]
        Model.TaxiCdmaInfo CdmaTaxiGetModelByDeviceNumber(string deviceNumber);

        [OperationContract]
        DataSet CdmaTaxiGetList(string strWhere);

        #endregion


        [OperationContract]
        DataSet CardCheckHistoryGetListWithParamater(string companyName,
        string phoneNumber, string startTime, string endTime);




        #region PhonePlatform
        [OperationContract]
        DataSet PhonePlatformGetList(string strWhere);

        [OperationContract]
        DataSet PhonePlatformGetListWithParameter(string parameter, string parameterVaule);
        #endregion


        [OperationContract]
        PassengerInfo AddPassengerByClient(PassengerInfo passenger);

        //------------------------------------------ForTest-------------------------------------------

        /// <summary>
        /// Add Trade successful  Info
        /// </summary>
        /// <param name="taxiGpsHistoryInfo"></param>
        [OperationContract]
        void AddTaxiGpsHistoryInfo(Model.TaxiGpsHistoryInfo taxiGpsHistoryInfo);

        //------------------------------------------------------------------------------------------------
    }
}
